package b.acct.impl

import b.acct.api.T账户Service
import b.cif.api.T客户Service
import b.utils.api.T底层Service
import b.utils.entity.{C事务PersistentEntity, C流水号PersistentEntity, C事务ReadSide}
import com.lightbend.lagom.scaladsl.api.ServiceLocator
import com.lightbend.lagom.scaladsl.api.ServiceLocator.NoServiceLocator
import com.lightbend.lagom.scaladsl.devmode.LagomDevModeComponents
import com.lightbend.lagom.scaladsl.persistence.cassandra.CassandraPersistenceComponents
import com.lightbend.lagom.scaladsl.playjson.JsonSerializerRegistry
import com.lightbend.lagom.scaladsl.server._
import com.softwaremill.macwire.wire
import play.api.libs.ws.ahc.AhcWSComponents

abstract class AC账户Application(context: LagomApplicationContext) extends LagomApplication(context)
  with AhcWSComponents
  with CassandraPersistenceComponents {

  override lazy val lagomServer: LagomServer = LagomServer.forServices(
    bindService[T账户Service].to(wire[C账户ServiceImpl])
  )

  persistentEntityRegistry.register(wire[C账户PersistentEntity])
  persistentEntityRegistry.register(wire[C事务PersistentEntity])
  persistentEntityRegistry.register(wire[C流水号PersistentEntity])

  readSide.register(wire[C账户ReadSide])
  readSide.register(wire[C事务ReadSide])

  lazy val v客户Service: T客户Service = serviceClient.implement[T客户Service]
  lazy val v底层Service: T底层Service = serviceClient.implement[T底层Service]

  override lazy val jsonSerializerRegistry: JsonSerializerRegistry = wire[C账户SerializerRegistry]

}

